<%--
  Created by IntelliJ IDEA.
  User: 小蟹
  Date: 2023/12/27
  Time: 12:21
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>个人中心</title>
    <script src="../js/jquery-3.4.1min.js"></script>
    <link rel="stylesheet" href="../css/bootstrap.min.css">
    <script src="../js/popper.min.js"></script>
    <script src="../js/bootstrap.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $('[name=uname]').blur(function () {
                let value = $('[name=uname]').val();
                $.ajax({
                    url:"/AdminUser/checkName",
                    data:{"uname":value},
                    type:"post",
                    dataType:"json",
                    success:function (data){
                        if (data){//data==true 用户名存在
                            $("#mySpan").html("<img src='/img/no.png'/>用户名已经存在");
                        }else {//用户名不存在
                            nameVal = name.value
                            $("#mySpan").html("<img src='/img/ok.png'/>");
                        }
                    }
                });
            })
        })
    </script>
</head>
<body>
<div class="container" style="margin-top: 10%">
    <div class="card">
        <div class="card-header">
            个人信息修改
        </div>
        <div class="card-body">
            <form action="/user/updateUser" method="post">
                <input type="hidden" name="uid" value="${user1.uid}">
                <div class="form-group">
                    <label for="exampleInputEmail1">Name</label>
                    <input type="text" value="${user1.uname}" name="uname" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
                    <span id="mySpan"></span>
                </div>
                <div class="form-group">
                    <label for="exampleInputPassword1">Password</label>
                    <input type="password" name="upassword" value="${user1.upassword}" class="form-control" id="exampleInputPassword1">
                </div>
                <button type="submit" class="btn btn-primary">Submit</button>
            </form>
<%--            <form action="/user/updateUser" method="post">--%>
<%--                <input type="hidden" name="uid" value="${user1.uid}">--%>
<%--                账户：<input type="text" id="uname" name="uname" value="${user1.uname}"/><br/>--%>
<%--                密码：<input type="text" id="upassword" name="upassword" value="${user1.upassword}"/><br/>--%>
<%--                <input type="submit" value="修改"/>--%>
<%--            </form>--%>

        </div>
    </div>
</div>

</body>
</html>
